<script type="text/javascript">
// Global Variable -------------------------------------------------
	var chkuse_date = "";
	var date_start = "";
	var date_end = "";
	var chkuse_prov = "";
	var chkbox90 = "";
	var chkbox94 = "";
	var chkbox95 = "";
	var chkbox96 = "";
	var chkbox00 = "";
	var chkuse_cause = "";
	var chkbox_cause1 = "";
	var chkbox_cause2 = "";
	var chkbox_cause0 = "";
	var cond_cause = "";
	var chkuse_evntyp = "";
	var chkbox_evntyp1 = "";
	var chkbox_evntyp2 = "";
	var chkbox_evntyp3 = "";
	var chkbox_evntyp4 = "";
	var cond_evntyp = "";
	var user_type = "1";
// end Global Variable ---------------------------------------------

// ------------------ Event timemap --------------------------------
var tm;
function onLoad(kml_fname) { // function of timemap
    tm = TimeMap.init({ //ฟังก์ชั่นเริ่มต้นแสดง map
        mapId: "map",  // Id of map div element (required)
        timelineId: "timeline",  // Id of timeline div element (required) 
        options: {
            eventIconPath: "images/"
        },
        datasets: [
            {
                title: "Event in Deep South Provinces",
                theme: "red",
                type: "kml",     // Data to be loaded in KML - must be a local URL
                options: {
					url: "kml/"+kml_fname// KML file to load
                }
            }
        ],
        bandInfo: [
            {
               width:          "85%", 
               intervalUnit:   Timeline.DateTime.DAY, 
		       intervalPixels: 210
            },
            {
               width:          "15%", 
               intervalUnit:   Timeline.DateTime.WEEK, 
		       intervalPixels: 150,
               showEventText:  false,
               trackHeight:    0.2,
               trackGap:       0.2
            }
        ]
    });
}
// show or hidden for event, victim or project -------------------
function ShowHiddenCondition(cas){
	if(cas==3){
		var ele = document.getElementById('cond_case3');
		ele.style.display="block";
		var ele = document.getElementById('cond_case12');
		ele.style.display="none";
		document.getElementById("timemap").innerHTML = "<div id=\"mapcontainer\"><div id=\"map\"></div></div>";
		map = new GMap(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
 		//map.addControl(new GLargeMapControl3D());
     	map.addControl(new GMapTypeControl());
	 	map.setCenter(new GLatLng(6.436765,101.280556), 9, G_NORMAL_MAP);
		checkDataset(); // auto summit
		
  	}else{
		var ele = document.getElementById('cond_case3');
		ele.style.display="none";
		var ele = document.getElementById('cond_case12');
		ele.style.display="block";
		if(cas==2){
			document.getElementById("numevent").innerHTML = "";
			document.getElementById("timemap").innerHTML = "<div id=\"mapcontainer\"><div id=\"map\"></div></div>";
			map = new GMap(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
 			//map.addControl(new GLargeMapControl3D());
     		map.addControl(new GMapTypeControl());
	 		map.setCenter(new GLatLng(6.436765,101.280556), 9, G_NORMAL_MAP);
		}else{
			document.getElementById("numevent").innerHTML = "";
			document.getElementById("timemap").innerHTML = "<div id=\"timelinecontainer\"><div id=\"timeline\"></div></div><div id=\"mapcontainer\"><div id=\"map\"></div></div>";
			//auto get first and current date
			//document.formcondition.date_start.value =getMonthNowFixDate("01");
			//document.formcondition.date_end.value = getDateNow();
			checkDataset();
		}
	}
}

// end show or hidden for event, victim or project -------------------
// show or hidden for condition of event and victim -------------------
function changeUseCause(){
	if(document.getElementById("chkuse_cause").checked){
		document.formcondition.chkbox_cause1.disabled = false;
		document.formcondition.chkbox_cause2.disabled = false;
		document.formcondition.chkbox_cause0.disabled = false;
	}else{
		document.formcondition.chkbox_cause1.disabled = true;
		document.formcondition.chkbox_cause2.disabled = true;
		document.formcondition.chkbox_cause0.disabled = true;
	}
}
function changeUseType(){
	if(document.getElementById("chkuse_evntyp").checked){
		document.formcondition.chkbox_evntyp1.disabled = false;
		document.formcondition.chkbox_evntyp2.disabled = false;
		document.formcondition.chkbox_evntyp3.disabled = false;
		document.formcondition.chkbox_evntyp4.disabled = false;
	}else{
		document.formcondition.chkbox_evntyp1.disabled = true
		document.formcondition.chkbox_evntyp2.disabled = true;
		document.formcondition.chkbox_evntyp3.disabled = true;
		document.formcondition.chkbox_evntyp4.disabled = true;
	}
}
function changeUseProv(){
	if(document.getElementById("chkuse_prov").checked){
		document.formcondition.chkbox90.disabled = false;
		document.formcondition.chkbox94.disabled = false;
		document.formcondition.chkbox95.disabled = false;
		document.formcondition.chkbox96.disabled = false;
		document.formcondition.chkbox00.disabled = false;
	}else{
		document.formcondition.chkbox90.disabled = true;
		document.formcondition.chkbox94.disabled = true;
		document.formcondition.chkbox95.disabled = true;
		document.formcondition.chkbox96.disabled = true;
		document.formcondition.chkbox00.disabled = true;
	}
}

// end show or hidden for condition of event and victim -------------------

// check for call event, victim or project map
function checkDataset(){
	// check date
	var d = getDateNow();
	d = d.replace('-','');
	d = d.replace('-','');
	var fname_from_cond = "gis_event"+d;
	//alert(fname_from_cond);
	if(document.getElementById("chkuse_date").checked){
		chkuse_date =  "1";
		fname_from_cond = fname_from_cond+"_"+chkuse_date;
		//alert(fname_from_cond);
		date_start =  document.getElementById("date_start").value;
		date_start = date_start.replace('-','');
		date_start = date_start.replace('-','');
		fname_from_cond = fname_from_cond+date_start;
		//alert(fname_from_cond);
		date_end =  document.getElementById("date_end").value;
		date_end = date_end.replace('-','');
		date_end = date_end.replace('-','');
		fname_from_cond = fname_from_cond+date_end;
		//alert(fname_from_cond);
	}else{ chkuse_date = "";}

	// check province
	if(document.getElementById("chkuse_prov").checked){
		chkuse_prov =  "1";
	}else{ chkuse_prov = "";}

	if(document.getElementById("chkbox90").checked){
		chkbox90 =  "90";
	}else{ chkbox90 = "";}
	
	if(document.getElementById("chkbox94").checked){
		chkbox94 =  "94";
	}else{ chkbox94 = "";}
	
	if(document.getElementById("chkbox95").checked){
		chkbox95 =  "95";
	}else{ chkbox95 = "";}
	
	if(document.getElementById("chkbox96").checked){
		chkbox96 =  "96";
	}else{ chkbox96 = "";}
	
	if(document.getElementById("chkbox00").checked){
		chkbox00 =  "00";
	}else{ chkbox00 = "";}
	fname_from_cond = fname_from_cond+"_"+chkuse_prov+chkbox90+chkbox94+chkbox95+chkbox96+chkbox00;
	//alert(fname_from_cond);
	//check cause
	if(document.getElementById("chkuse_cause").checked){
		chkuse_cause =  "1";
	}else{ chkuse_cause = "";}
	if(document.getElementById("chkbox_cause1").checked){
		chkbox_cause1 =  ",1";
	}else{ chkbox_cause1 = "";}
	if(document.getElementById("chkbox_cause2").checked){
		chkbox_cause2 =  ",2";
	}else{ chkbox_cause2 = "";}

	if(document.getElementById("chkbox_cause0").checked){
		chkbox_cause0 =  ",3,4,5";
	}else{ chkbox_cause0 = "";}
	fname_from_cond = fname_from_cond+"_"+chkuse_cause+chkbox_cause1+chkbox_cause2+chkbox95+chkbox_cause0;
	//alert(fname_from_cond);
	if(chkuse_cause=="1"){
		cond_cause = chkbox_cause1+chkbox_cause2+chkbox_cause0;
		cond_cause = "("+cond_cause.substring(1)+")";
	}else{ cond_cause = "";}
	
	//check event type
	if(document.getElementById("chkuse_evntyp").checked){
		chkuse_evntyp =  "1";
	}else{ chkuse_evntyp = "";}
	if(document.getElementById("chkbox_evntyp1").checked){
		chkbox_evntyp1 =  ",1";
	}else{ chkbox_evntyp1 = "";}
	if(document.getElementById("chkbox_evntyp2").checked){
		chkbox_evntyp2 =  ",2";
	}else{ chkbox_evntyp2 = "";}
	if(document.getElementById("chkbox_evntyp3").checked){
		chkbox_evntyp3 =  ",3";
	}else{ chkbox_evntyp3 = "";}
	if(document.getElementById("chkbox_evntyp4").checked){
		chkbox_evntyp4 =  ",4";
	}else{ chkbox_evntyp4 = "";}
	fname_from_cond = fname_from_cond+"_"+chkuse_evntyp+chkbox_evntyp1+chkbox_evntyp2+chkbox_evntyp3+chkbox_evntyp4;
//alert(fname_from_cond);
	if(chkuse_evntyp=="1"){
		cond_evntyp = chkbox_evntyp1+chkbox_evntyp2+chkbox_evntyp3+chkbox_evntyp4;
		cond_evntyp = "("+cond_evntyp.substring(1)+")";
	}else{cond_evntyp = "";}
	
	//alert(cond_cause);
	user_type = document.getElementById("user_type").value;
	fname_from_cond = fname_from_cond+"_u"+user_type;
	fname_from_cond = fname_from_cond.replace(/,/g,'');
	fname_from_cond = fname_from_cond+".kml";
	//alert(fname_from_cond);
	if(document.getElementById("dataset1").checked){
		onLoadMapEvent(0,fname_from_cond);
	}else{
		if(document.getElementById("dataset2").checked){
				//onLoadMapVictim();
				setTimeout("MarkingVictim();",2000);
		}else{
				//onLoadMapProject();
				setTimeout("MarkingProject();",2000);
		}
	}
}
// end check for call event, victim or project map

function onLoadMapEvent(bypass,filename){
	if(bypass){
		onLoad(filename);
	}else{
	
   	var request = GXmlHttp.create();
	//alert("test1");
	var urlstr="first_timemap_genkml.php?chkuse_date="+chkuse_date+"&date_start="+date_start+"&date_end="+date_end+"&chkuse_prov="+chkuse_prov+"&chkbox90="+chkbox90+"&chkbox94="+chkbox94+"&chkbox95="+chkbox95+"&chkbox96="+chkbox96+"&chkbox00="+chkbox00+"&cond_cause="+cond_cause+"&cond_evntyp="+cond_evntyp+"&user_type="+user_type+"&fname="+filename;
	//alert(urlstr);
	request.open('POST', urlstr , true);	// request XML from PHP with AJAX call
	request.onreadystatechange = function () {
	//alert("onreadystatechange="+request.readyState);
	if (request.readyState == 4) {
		var textResponse=request.responseText;
		//var location_leghth = 0;
		//var locations = xmlDoc.documentElement.getElementsByTagName("location");
		//alert(textResponse);
	    onLoad(filename); // call time-map function
	}//end if request.readyState == 4
	}// end function1 of onreadystatechange
	request.send(null); //end  function2 of onreadystatechange
	}//by pass
}

//------------------------------------------------------------------

//------------------------ Victim map -----------------------------
function MarkingVictim(){
document.getElementById("numevent").innerHTML = "";
			document.getElementById("timemap").innerHTML = "<div id=\"mapcontainer\"><div id=\"map\"></div></div>";
			map = new GMap(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
 			//map.addControl(new GLargeMapControl3D());
     		map.addControl(new GMapTypeControl());
	 		map.setCenter(new GLatLng(6.436765,101.280556), 9, G_NORMAL_MAP);
     getMarkers();
     
     GEvent.addListener(map, "click", function(overlay, point) {
		      if (overlay){	// marker clicked
			      overlay.openInfoWindowHtml(overlay.infowindow);	// open InfoWindow
		      } else if (point) {	// background clicked
			      
		      }
	      });
		  //add by somsawat
		 /* GEvent.addListener(map,'zoomend',function() {
				getMarkers();
			});
 
			GEvent.addListener(map,'moveend',function() {
				getMarkers();
			});*/
		  //end,,,,,,,,,,,,,,,,,,,,,,,,
}

function getMarkers(){
	var urlstr="readVictim.php";
	var request = GXmlHttp.create();
	var numvic_all = 0;
	urlstr = urlstr+"?chkuse_date="+chkuse_date+"&date_start="+date_start+"&date_end="+date_end+"&chkuse_prov="+chkuse_prov+"&chkbox90="+chkbox90+"&chkbox94="+chkbox94+"&chkbox95="+chkbox95+"&chkbox96="+chkbox96+"&chkbox00="+chkbox00+"&cond_cause="+cond_cause+"&cond_evntyp="+cond_evntyp+"&user_type="+user_type;
	//urlstr = urlstr+"?top="+mapTop+"&bottom="+mapBottom+"&left="+mapLeft+"&right="+mapRight+"&prov=";
	//alert(urlstr);
    request.open('GET', urlstr , true);	// request XML from PHP with AJAX call
    request.onreadystatechange = function () {
	if (request.readyState == 4) {
		var xmlDoc = request.responseXML;
		locations = xmlDoc.documentElement.getElementsByTagName("location");
		markers = [];
		//alert("ค้นพบจำนวน "+locations.length+" หมู่บ้าน");
		document.getElementById("numevent").innerHTML = "ผลการค้นหา "+locations.length+" หมู่บ้าน";
		//alert("markers len="+markers.length);
		if (locations.length){
			for (var i = 0; i < locations.length; i++) { // cycle thru locations
				//change icon------
				var Icon = new GIcon(); 
				//if(locations[i].getAttribute("losbody")=="4"){
					//Icon.image = "test.ico"; 
					//Icon.image = "user_male.png"; 
				//}else{
					//Icon.image = "testyel.ico"; 
					Icon.image = "iconfile/circle_red.png";
				//}
				var numvictim;
				var sizexy;;
				numvictim = locations[i].getAttribute("numvic");
				numvic_all = numvic_all + numvictim*1;
				if(numvictim >= 2 && numvictim <=4){
				  sizexy = 12;
				}else{
				  if(numvictim >= 5 && numvictim <=7){
						sizexy = 14;
				  }else{
						if(numvictim >= 8 && numvictim <=10){
							sizexy = 16
						}else{
							sizexy = 10;
						}
				  }
				}
				Icon.iconSize = new GSize(sizexy, sizexy); 
				//Icon.shadow = "myshadow.png"; 
				//Icon.shadowSize = new GSize(36, 34); 
				Icon.iconAnchor = new GPoint(8, 16); 
				Icon.infoWindowAnchor = new GPoint(8,1); 
				//Icon.transparent = "mytran.png";	//Icon.imageMap=[9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0]; 
				//Icon.printImage = "mymarkerie.gif"; 
				//Icon.mozPrintImage = "mymarkerff.gif"; 
				//Icon.printShadow = "myshadow.gif";
				//----end change icon
				markers[i] = new GMarker(new GLatLng(locations[i].getAttribute("lat"),locations[i].getAttribute("lng")), {icon: Icon});
				// Add attributes to the marker so we can poll them later.
				// When clicked, an overlay will have these properties.
				markers[i].infowindow = "<b>"+locations[i].getAttribute("vill_name")+"</b>"+"("+locations[i].getAttribute("id")+")"+" "+locations[i].getAttribute("tam_name")+" "+locations[i].getAttribute("amp_name")+" "+locations[i].getAttribute("prov_name")+"<br>มีผู้ได้รับผลกระทบจำนวน "+locations[i].getAttribute("numvic")+" คน"+locations[i].getAttribute("list_victim");
							
				// Useful things to store on a marker (Not needed for this example, could be removed)
				// Tells you what index in the markers[] array an overlay is
				markers[i].markerindex = i;
				// Store the location_id of the location the marker represents.
				// Very useful to know the true id of a marker, you could then make
				// AJAX calls to the database to update the information if you had it's location_id
				markers[i].db_id = locations[i].getAttribute("location_id");
				map.addOverlay(markers[i]);
			}//end for
		}//end if locations.length
		document.getElementById("numevent").innerHTML = "ผลการค้นหา "+numvic_all+" คน ใน "+locations.length+" หมู่บ้าน";
	   }//end if request.readyState == 4
	}// end function1 of onreadystatechange
	request.send(null); //end  function2 of onreadystatechange
}
		
		//]]>
//---------------------------------------------------------------------------------
// end Victim  map --------------------------------------------

//---------------------------------- Project map ---------------------
function MarkingProject(){
     getMarkersProject();
     GEvent.addListener(map, "click", function(overlay, point) {
	 if (overlay){	// marker clicked
		overlay.openInfoWindowHtml(overlay.infowindow);	// open InfoWindow
	 } else if (point) {	// background clicked
			      
		    }
	 });
}

function getMarkersProject(){
	//alert("1");
	var urlstr="readProject.php";
	var request = GXmlHttp.create();
	//alert("2");
    request.open('GET', urlstr , true);	// request XML from PHP with AJAX call
    request.onreadystatechange = function () {
	if (request.readyState == 4) {
		var xmlDoc = request.responseXML;
		locations = xmlDoc.documentElement.getElementsByTagName("location");
		markers = [];
		alert("ค้นพบจำนวน "+locations.length+" หมู่บ้าน");
		//alert("markers len="+markers.length);
		if (locations.length){
			for (var i = 0; i < locations.length; i++) { // cycle thru locations
				//change icon------
				var Icon = new GIcon(); 
				Icon.image = "iconfile/circle_red.png";
				var sumoffund;
				var sizexy;;
				sumoffund = locations[i].getAttribute("sumoffund");
				sizexy = (sumoffund*1)+2;
				Icon.iconSize = new GSize(sizexy, sizexy); 
				Icon.iconAnchor = new GPoint(8, 16); 
				Icon.infoWindowAnchor = new GPoint(8,1); 
				markers[i] = new GMarker(new GLatLng(locations[i].getAttribute("lat"),locations[i].getAttribute("lng")), {icon: Icon});
				// Add attributes to the marker so we can poll them later.
				// When clicked, an overlay will have these properties.
				markers[i].infowindow = "<b>"+locations[i].getAttribute("vill_name")+"</b>"+"("+locations[i].getAttribute("id")+")"+" "+locations[i].getAttribute("tam_name")+" "+locations[i].getAttribute("amp_name")+" "+locations[i].getAttribute("prov_name")+"<br>มีโครงการทั้งหมด "+locations[i].getAttribute("sumoffund")+" โครงการ";
							
				// Useful things to store on a marker (Not needed for this example, could be removed)
				// Tells you what index in the markers[] array an overlay is
				markers[i].markerindex = i;
				// Store the location_id of the location the marker represents.
				// Very useful to know the true id of a marker, you could then make
				// AJAX calls to the database to update the information if you had it's location_id
				markers[i].db_id = locations[i].getAttribute("location_id");
				map.addOverlay(markers[i]);
			}//end for
		}//end if locations.length
	   }//end if request.readyState == 4
	}// end function1 of onreadystatechange
	request.send(null); //end  function2 of onreadystatechange
}
		
// end Project map ---------------------------------------------------

//call calendar ----------------------
//start calender ------------------
function getCalendar(in_dateField) 
{
    if (calendarWindow && !calendarWindow.closed) {
        alert('Calendar window already open.  Attempting focus...');
        try {
            calendarWindow.focus();
        }
        catch(e) {}
        
        return false;
    }

    var cal_width = 415;
    var cal_height = 310;

    // IE needs less space to make this thing
    if ((document.all) && (navigator.userAgent.indexOf("Konqueror") == -1)) {
        cal_width = 410;
    }

    calendarTarget = in_dateField;
    calendarWindow = window.open('calendar.html', 'dateSelectorPopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,dependent=no,width='+cal_width+',height='+cal_height + (calendarScreenX != 'auto' ? ',screenX=' + calendarScreenX : '') + (calendarScreenY != 'auto' ? ',screenY=' + calendarScreenY : ''));

    return false;
}

// {{{ killCalendar()

function killCalendar() 
{
    if (calendarWindow && !calendarWindow.closed) {
        calendarWindow.close();
    }
}

// }}}
//---------------------------------
var calendarWindow = null;
var calendarColors = new Array();
calendarColors['bgColor'] = '#BDC5D0';
calendarColors['borderColor'] = '#333366';
calendarColors['headerBgColor'] = '#143464';
calendarColors['headerColor'] = '#FFFFFF';
calendarColors['dateBgColor'] = '#8493A8';
calendarColors['dateColor'] = '#004080';
calendarColors['dateHoverBgColor'] = '#FFFFFF';
calendarColors['dateHoverColor'] = '#8493A8';
var calendarMonths = new Array('มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม');
var calendarWeekdays = new Array('S', 'M', 'T', 'W', 'T', 'F', 'S', 'S');
var calendarUseToday = true;
var calendarFormat = 'y/m/d';
var calendarStartMonday = true;
var calendarScreenX = 100; // either 'auto' or numeric
var calendarScreenY = 100; // either 'auto' or numeric

//---------------------------------------
</script>
<form name="formcondition" id="formcondition">
<table width="1000" border="0" align="left" cellspacing="0">
      <tr valign="top">
        <td height="35" colspan="2">	<strong>เลือกชุดข้อมูล:</strong> <input name="dataset" id="dataset1" type="radio" value="1" checked="checked" onclick="ShowHiddenCondition(1);"/>
                      เหตุการณ์ 
                        <input name="dataset" id="dataset2" type="radio" value="2" onclick="ShowHiddenCondition(2);"/>
ผู้ได้รับผลกระทบ
</td>
      </tr>
      <tr valign="top">
        <td width="227"><table border="0">
          <tr>
            <td>
				<!--insert div-->
				<div id="cond_case3" style="display:none">
				<!--table width=220 border=0 align=center>
				<tr><td><div align="center"><input type="button" name="Submit3" value="ตกลง" onclick="javascript:checkDataset();"/></div></td>
				<td><input type="button" name="Submit4" value="ยกเลิก" /></td>
				</tr></table-->
				 </div>
				 
				 <div id="cond_case12">
                <table border="0" cellspacing="0" width="220">
                  <tr>
                    <td colspan="2"><input name="user_type" id="user_type" type="hidden" value="<?=$user_type?>" /></td>
                  </tr>
                  <tr>
                    <td colspan="2"><input name="chkuse_cause" type="checkbox" id="chkuse_cause" value="1" onchange="changeUseCause()"/>
                        <strong>สาเหตุของเหตุการณ์ฯ</strong></td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox_cause1" type="checkbox" id="chkbox_cause1" value="1" disabled="disabled"/>
                      ความไม่สงบ</td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox_cause2" type="checkbox" id="chkbox_cause2" value="2"  disabled="disabled"/>
                      อยู่ระหว่างตรวจสอบ</td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox_cause0" type="checkbox" id="chkbox_cause0" value="3 4 5 9"  disabled="disabled"/>
                      อื่นๆ (ส่วนตัว อุบัติเหตุ ไม่ระบุ) </td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><input name="chkuse_evntyp" type="checkbox" id="chkuse_evntyp" value="1" onchange="changeUseType()"/>
                      <strong>ประเภทเหตุการณ์ฯ</strong></td>
                  </tr>
                  <tr>
                    <td colspan="2"><table>
                      <tr>
                          <td>&nbsp;&nbsp;&nbsp;
                            <input name="chkbox_evntyp1" type="checkbox" id="chkbox_evntyp1" value="1" disabled="disabled"/>
ระเบิด</td>
                        <td><input name="chkbox_evntyp2" type="checkbox" id="chkbox_evntyp2" value="2" disabled="disabled"/>
                        ยิง</td>
                      </tr>
                        <tr>
                          <td>&nbsp;&nbsp;&nbsp;
                            <input name="chkbox_evntyp3" type="checkbox" id="chkbox_evntyp3" value="3" disabled="disabled"/> 
                            วางเพลิง</td>
                          <td><input name="chkbox_evntyp4" type="checkbox" id="chkbox_evntyp4" value="4" disabled="disabled"/> 
                            อื่นๆ</td>
                        </tr>
                      </table>                    </td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><strong>
                      <input name="chkuse_date" type="checkbox" id="chkuse_date" value="1" checked="checked" disabled="disabled" />
                      <strong>ช่วงเวลา</strong></strong></td>
                  </tr>
                  <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;ตั้งแต่วันที่</td>
                    <td><input name="date_start" type="text" id="date_start" value="2551-01-01" size="10" />
                    <a href="#" onclick="return getCalendar(document.forms[0].date_start);"><img src="images/calendar.png" border="0" /></a></td>
                  </tr>
                  <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;ถึงวันที่</td>
                    <td><input name="date_end" type="text" id="date_end" value="2551-02-01" size="10" />
                    <a href="#" onclick="return getCalendar(document.forms[0].date_end);"><img src="images/calendar.png" border="0" /></a></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><input name="chkuse_prov" type="checkbox" id="chkuse_prov" value="1" checked="checked" onchange="changeUseProv()" />
                    <strong>ที่เกิดเหตุ / ภูมิลำเนา</strong> </td>
                  </tr>
                  <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox90" type="checkbox" id="chkbox90" value="90" checked="checked" />
                      สงขลา</td>
                    <td><input name="chkbox94" type="checkbox" id="chkbox94" value="94" checked="checked" />
                      ปัตตานี</td>
                  </tr>
                  <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox95" type="checkbox" id="chkbox95" value="95" />
                      ยะลา</td>
                    <td><input name="chkbox96" type="checkbox" id="chkbox96" value="96"/>
                      นราธิวาส</td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="chkbox00" type="checkbox" id="chkbox00" value="00" />
                      นอกพื้นที่ 4 จังหวัด </td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;</td>
                  </tr>
                  <!--tr>
                    <td colspan="2"><strong>เลือกชุดข้อมูล</strong></td>
                  </tr>
                  <tr>
                    <td colspan="2"><input name="chkbox_show_event" type="checkbox" id="chkbox_show_event" value="1" />
                        <strong>เหตุการณ์ฯ</strong></td>
                  </tr>
                  <tr>
                    <td>ประเภท</td>
                    <td><input name="chkbox_type1" type="checkbox" id="chkbox_type1" value="1" />
                      วางระเบิด
                      <input name="chkbox_type2" type="checkbox" id="chkbox_type2" value="2" />
                      ยิง <br />
                      <input name="chkbox_type3" type="checkbox" id="chkbox_type3" value="3" />
                      วางเพลิง
                      <input name="chkbox_type4" type="checkbox" id="chkbox_type4" value="4" />
                      อื่นๆ<br />
                      <input name="chkbox_type9" type="checkbox" id="chkbox_type9" value="9" />
                      ไม่ระบุ</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><input name="chkbox_show_victim" type="checkbox" id="chkbox_show_victim" value="1" />
                        <strong>ผู้ได้รับผลกระทบ</strong></td>
                  </tr>
                  <tr>
                    <td>การบาดเจ็บ</td>
                    <td><input name="chkbox_inj1" type="checkbox" id="chkbox_inj1" value="1" />
                      บาดเจ็บ
                      <input name="chkbox_inj2" type="checkbox" id="chkbox_inj2" value="2" />
                      เสียชีวิต</td>
                  </tr>
                  <tr>
                    <td>เพศ</td>
                    <td><input name="chkbox_sex1" type="checkbox" id="chkbox_sex1" value="1" />
                      ชาย
                      <input name="chkbox_sex2" type="checkbox" id="chkbox_sex2" value="2" />
                      หญิง</td>
                  </tr>
                  <tr>
                    <td>ศาสนา</td>
                    <td><input name="chkbox_reg1" type="checkbox" id="chkbox_reg1" value="1" />
                      พุทธ
                      <input name="chkbox_reg2" type="checkbox" id="chkbox_reg2" value="2" />
                      คริสต์ <br />
                      <input name="chkbox_reg3" type="checkbox" id="chkbox_reg3" value="3" />
                      อิสลาม
                      <input name="chkbox_reg4" type="checkbox" id="chkbox_reg4" value="4" />
                      อื่นๆ </td>
                  </tr-->
                  <tr>
                    <td colspan="2"><div align="center">
                        <input type="button" name="Submit3" value="ตกลง" onclick="javascript:checkDataset();"/>
                        <input type="reset" name="Submit4" value="ยกเลิก" />
                    </div></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><div id="numevent" align="center"></div></td>
                  </tr>
                </table>
				 </div>
				  <!-- end insert div-->
            </td>
          </tr>
        </table>
		
		
		
		</td>
        <td width="746"><table width="100%" border="0">
          <tr valign="top">
            <td height="700"><div id="timemap">
        <div id="timelinecontainer">
          <div id="timeline"></div>
        </div>
        <div id="mapcontainer">
          <div id="map"></div>
        </div>
    </div>			</td>
          </tr>
        </table></td>
      </tr>
</table>
</form>	  
<script>
	ShowHiddenCondition(1);
</script>